﻿/*******************************************************************************
 **  Name:                                        **
 **  Description:                                                             **
 **                                                                           **
 **  CDDL: Open Source Initiative (OSI) Approved License                            **
 **                                                                           **
 **  Copyright (c) 2009-2010 Barry "Gian" James  <bjames@munixos.net>         **
 **  All rights reserved.                                                     **
 **                                                                           **
 **  The contents of this file are subject to the terms of the CDDL:          **
 **  Common Development and Distribution License (the "License").             **
 **  You may not use this file except in compliance with the License.         **
 **                                                                           **
 **  You can obtain a copy of the license at $PROJECT_ROOT/LICENSE            **
 **  or http://www.opensolaris.org/os/licensing.  This code is Open Source    **
 **  and you are free to use it within the confines of the license, even      **
 **  for your own closed-source commercial projects, as long as you follow    **
 **  the terms set forth in the CDDL.                                         **
 **                                                                           **
 **  When distributing Covered Code, include this CDDL HEADER in each         **
 **  file and include the License file at $PROJECT_ROOT/LICENSE.              **
 **  If applicable, add the following below this CDDL HEADER, with the        **
 **  fields enclosed by brackets "[]" replaced with your own identifying      **
 **  information: Portions Copyright [yyyy] [name of copyright owner]         **
 **                                                                           **
 ******************************************************************************/
// Created on November 1, 2010, 7:25 AM
// Modified $Date$ by $Author$
// $Id$

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace sat1baf1
{
    public partial class WeaponSizeForm : Form
    {
        MainForm mf;
        public WeaponSizeForm(MainForm f)
        {
            InitializeComponent();
            mf = f;
            InitializeData();
        }
        private void InitializeData()
        {
            WeaponSize[] slist = mf.WeaponSizes;

            foreach (WeaponSize ws in slist)
            {
                if (ws == null) break;
                ListViewItem lvi = new ListViewItem();
                lvi.Text = ws.Name;
                lvi.SubItems.Add(ws.Abbr.ToString());

                if (ws.Defense >= 0)
                    lvi.SubItems.Add("+" + ws.Defense.ToString());
                else
                    lvi.SubItems.Add(ws.Defense.ToString());
                if (ws.Attack >= 0)
                    lvi.SubItems.Add("+" + ws.Attack.ToString());
                else
                    lvi.SubItems.Add(ws.Attack.ToString());
                if (ws.StealthHide >= 0)
                    lvi.SubItems.Add("+" + ws.StealthHide.ToString());
                else
                    lvi.SubItems.Add(ws.StealthHide.ToString());

                lvi.SubItems.Add(String.Format(ws.WoundsStr, ws.WoundsConst));
                lvi.SubItems.Add(String.Format(ws.EncumbranceStr, ws.EncumbranceConst));
                lvi.SubItems.Add(ws.Squares);
                if (ws.Reach == 0)
                    lvi.SubItems.Add("Same square");
                else
                    lvi.SubItems.Add(String.Format("{0} squares", ws.Reach));


                ////////////////////////////////// Add to ListView
                lvWpnSize.Items.Add(lvi);

            }

        }

        private void WeaponSizeForm_Load( object sender, EventArgs e )
        {

        }
    }
}
